<%@ page language="java"  pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/views/common/taglib.jsp" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>确认订单</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="HandheldFriendly" content="true" />
    <meta name="viewport" content="width=320.1, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <%@ include file="/WEB-INF/views/common/resource.jsp" %>
</head>
<body>
<input type="hidden" value="${order.order_no}" id="order_no">
<input type="hidden" value="${message_id}" id="message_id">

<div class="pop_bg"></div>
<div class="pop_box np" style="padding: 10% 5%; overflow: visible;" id="jd_box">
    <h1>请填写拒单理由：</h1>
    <textarea id="reason"></textarea>
        <input type="button" onclick="rejectOrder()" value="确认拒单" style="margin-top: 18px;" />
    <em class="close_pop"><img src="${itx}/images/close_icon.png" width="35" /></em>
</div>

<div class="pop_box np" style="padding: 10% 5%; overflow: visible;" id="chose_shopper_box">
    <ul class="chose_shopper_list" >
        <li>
            <label>
                <img src="${user.weChatInfo.headimgurl}" width="35" height="35" />
                <span>自己配送</span>
                <input type="radio" value="0" name="chose_shopper" />
            </label>
        </li>

        <c:forEach var="list" items="${couriers}">
            <li>
                <label>
                    <c:choose>
                        <c:when test="${list.courier_head_img_url eq null}">
                            <img src="${itx}/images/shopper_head.png" width="35" height="35" />
                        </c:when>
                        <c:otherwise>
                            <img src="${list.courier_head_img_url}" width="35" height="35" />
                        </c:otherwise>
                    </c:choose>
                    <span>${list.courier_name}</span>
                    <input type="radio" value="${list.courier_id}" name="chose_shopper" />
                </label>
            </li>
        </c:forEach>
    </ul>
    <em class="close_pop"><img src="${itx}/images/close_icon.png" width="35" /></em>
    <div class="order_logistics_btns">
        <a class="chose_shopper" onclick="setCourier()">确定</a>
    </div>
</div>


<div class="page order pt0">
    <div class="order_detil_head">
        <h1>订单号${order.order_no}</h1>
        <c:choose>
            <c:when test="${order.order_status eq 'WAITING_ALLOCATION_COURIER'}">
                <span style="color: green">待配送</span>
            </c:when>

            <c:when test="${order.order_status eq 'WAITING_FOR_DELIVERY'}">
                <span style="color: orangered">配送中</span>
            </c:when>

            <c:when test="${order.order_status eq 'FINISHED'}">
                <span style="color: red">已完成</span>
            </c:when>
        </c:choose>

    </div>
    <div class="order_detil_content">
        <div class="order_detil_infobox">
            <strong>${order.receiver}</strong><span>${order.mobile}</span>
            <p><i class="iconfont icon-site2"></i>${order.city_name}${order.area_name}${order.address}</p>
            <a href="tel:${order.mobile}"><img src="${itx}/images/call_phone.png" width="30" /></a>
        </div>
        <div class="order_detil_infobox">
            <h1>商品清单</h1>

            <ul class="order_detil_prolist">

                <c:forEach var="detail" items="${order.order_details}">
                    <li>
                        <c:if test="${detail.type eq 'GIVEAWAY'}">
                            <div class="free_info_box">
                                <em>赠</em>
                                <span>${detail.goods_name}</span>
                            </div>
                        </c:if>
                        <div class="pro_img_box"><img src="${detail.goods_img}" width="70" height="70" /></div>
                        <div class="pro_info_box">
                            <strong>${detail.goods_name}</strong>
                            <span>¥${detail.goods_price}</span>
                        </div>
                        <div class="pro_info_box bottom">
                            <em>规格：${detail.goods_specifications}</em>
                            <span>X${detail.goods_num}</span>
                        </div>
                    </li>
                </c:forEach>

            </ul>
            <div class="pro_total_box">
                <span>共${fn:length(order.order_details)}件</span>
                <span>配送费：¥0</span>
                <c:choose>
                    <c:when test="${order.is_price_off eq 1}">
                        <strong>已减¥${order.off_price} 总计：¥${order.order_price}</strong>
                    </c:when>
                    <c:otherwise>
                        <strong>总计：¥${order.order_price}</strong>
                    </c:otherwise>
                </c:choose>
            </div>


        </div>
        <div class="order_detil_infobox">
            <dl>
                <dt>支付方式</dt>
                <dd>货到付款</dd>
            </dl>
            <dl>
                <dt>订单时间</dt>
                <dd>${order.create_time}</dd>
            </dl>
        </div>
        <div class="clear"></div>
    <%--等待接单--%>
    <c:if test="${order.order_status eq 'WAITING_FOR_RECEIVING_ORDER'}">
        <div class="bottom_btns">
            <ul>
                <li id="jd">拒单</li>
                <li onclick="acceptOrder()">接单</li>
            </ul>
        </div>
    </c:if>

    <%--等待选择配送员--%>
    <c:if test="${order.order_status eq 'WAITING_ALLOCATION_COURIER'}">
        <div class="order_detil_infobox">
            <strong>配送员</strong><span>无</span>
            <a  id="chose_shopper" style="top: 62%; color: dodgerblue">选择配送员</a>
        </div>
    </c:if>

    <%--等待收货--%>
    <c:if test="${order.order_status eq 'WAITING_FOR_DELIVERY'}">
        <div class="order_detil_infobox">
            <c:choose>
                <c:when test="${order.courier_id eq 0}">
                    <strong>配送员</strong><span>经销商配送</span>
                </c:when>
                <c:otherwise>
                    <strong>配送员</strong><span>${courier_info.courier_name}</span>
                    <a href="tel:${courier_info.courier_mobile}"><img src="${itx}/images/call_phone.png" width="30" /></a>
                </c:otherwise>
            </c:choose>
        </div>
    </c:if>


    <%--已完成--%>
    <c:if test="${order.order_status eq 'FINISHED'}">
        <div class="order_detil_infobox">
            <c:choose>
                <c:when test="${order.courier_id eq 0}">
                    <strong>配送员</strong><span>经销商配送</span>
                </c:when>
                <c:otherwise>
                    <strong>配送员</strong><span>${courier_info.courier_name}</span>
                    <a href="tel:${courier_info.courier_mobile}"><img src="${itx}/images/call_phone.png" width="30" /></a>
                </c:otherwise>
            </c:choose>
        </div>

        <c:choose>
            <c:when test="${order.customer_evaluate_status eq 0}">
                <div class="order_detil_infobox">
                    <strong>我的评价</strong><span>未评价</span>
                </div>
            </c:when>
            <c:otherwise>
                <div class="order_detil_infobox">
                    <div class="evaluate_box">
                        <h1>我的评价</h1>
                        <dl>
                            <dt>配送速度：</dt>
                            <dd>
                                <input type="checkbox" id="eva_speed1" name="speed" />
                                <label for="eva_speed1"></label>
                                <input type="checkbox" id="eva_speed2" name="speed" />
                                <label for="eva_speed2"></label>
                                <input type="checkbox" id="eva_speed3" name="speed" />
                                <label for="eva_speed3"></label>
                                <input type="checkbox" id="eva_speed4" name="speed" />
                                <label for="eva_speed4"></label>
                                <input type="checkbox" id="eva_speed5" name="speed" />
                                <label for="eva_speed5"></label>
                            </dd>
                        </dl>
                        <dl>
                            <dt>服务态度：</dt>
                            <dd>
                                <input type="checkbox" id="eva_attitude1" name="attitude" />
                                <label for="eva_attitude1"></label>
                                <input type="checkbox" id="eva_attitude2" name="attitude" />
                                <label for="eva_attitude2"></label>
                                <input type="checkbox" id="eva_attitude3" name="attitude" />
                                <label for="eva_attitude3"></label>
                                <input type="checkbox" id="eva_attitude4" name="attitude" />
                                <label for="eva_attitude4"></label>
                                <input type="checkbox" id="eva_attitude5" name="attitude" />
                                <label for="eva_attitude5"></label>
                            </dd>
                        </dl>
                        <dl>
                            <dt>商品完好度：</dt>
                            <dd>
                                <input type="checkbox" id="eva_integrity1" name="integrity" />
                                <label for="eva_integrity1"></label>
                                <input type="checkbox" id="eva_integrity2" name="integrity" />
                                <label for="eva_integrity2"></label>
                                <input type="checkbox" id="eva_integrity3" name="integrity" />
                                <label for="eva_integrity3"></label>
                                <input type="checkbox" id="eva_integrity4" name="integrity" />
                                <label for="eva_integrity4"></label>
                                <input type="checkbox" id="eva_integrity5" name="integrity" />
                                <label for="eva_integrity5"></label>
                            </dd>
                        </dl>
                    </div>
                    <textarea>哈哈哈哈哈哈哈</textarea>
                </div>
            </c:otherwise>
        </c:choose>
    </c:if>
    </div>
</div>

<script type="text/javascript">
    $('.pop_bg').click(function(e){
        $('.pop_bg').hide();
        $('.pop_box').hide();
    })

    $('#close').click(function(e){
        $('.pop_bg').hide();
        $('.pop_box').hide();
    })

    $('.close_pop').click(function(e){
        $('.pop_bg').hide();
        $('.pop_box').hide();
    })

    $('#jd').click(function(e){
        $('.pop_bg').height($(document).height());
        $('.pop_bg').show();
        $('#jd_box').show();
    })

    $('#chose_shopper').click(function(e){
        $('.pop_bg').height($(document).height());
        $('.pop_bg').show();
        $('#chose_shopper_box').show();
        $('#chose_shopper_box2').show();
    })
</script>
<script src="${rtx}/js/checkOrder.js"></script>
</body>
</html>
